﻿using System.Linq.Expressions;

namespace RbacPermissionSystem.Repositories
{
    public interface IRepository<TEntity> where TEntity : class
    {
        Task<int> DeleteAsync(Expression<Func<TEntity, bool>> predicate);
        Task<int> DeleteAsync(int PrimaryKey);
        Task<int> DeleteAsync(List<int> PrimaryKeys);
        Task<TEntity> FindAsync(int PrimaryKey);
        Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> predicate);
        Task<int> InsertAsync(List<TEntity> entities);
        Task<TEntity> InsertAsync(TEntity entity);
        Task<bool> IsExistsAsync(Expression<Func<TEntity, bool>> predicate);
        IQueryable<TEntity> Queryable();
        Task<List<TEntity>> QueryAsync();
        Task<List<TEntity>> QueryAsync(Expression<Func<TEntity, bool>> predicate = null);
        Task<TEntity> UpdateAsync(int PrimaryKey, TEntity entity);
        Task<TEntity> UpdateAsync(TEntity entity);
    }
}